package com.prs.crm.action.personalset;

import java.util.List;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;
import org.courser.struts.BaseAction;
import org.courser.ui.PaginationSupport;

import com.prs.crm.domain.personalset.ShortcutWay;
import com.prs.crm.domain.sys.Menu;
import com.prs.crm.service.personalSet.ShortcutWayService;
import com.prs.crm.service.sys.MenuService;

public class ShortcutWayAction extends BaseAction{

	private static final long serialVersionUID = 1L;
	private Integer[] ids;
	private PaginationSupport pagination;
	private ShortcutWay shortcutWay;
	private ShortcutWayService shortcutWayService;
	
	private List<Menu> menu;
	private MenuService menuService;
	public Integer[] getIds() {
		return ids;
	}
	public void setIds(Integer[] ids) {
		this.ids = ids;
	}
	public PaginationSupport getPagination() {
		return pagination;
	}
	public void setPagination(PaginationSupport pagination) {
		this.pagination = pagination;
	}
	public ShortcutWay getShortcutWay() {
		return shortcutWay;
	}
	public void setShortcutWay(ShortcutWay shortcutWay) {
		this.shortcutWay = shortcutWay;
	}
	public ShortcutWayService getShortcutWayService() {
		return shortcutWayService;
	}
	public void setShortcutWayService(ShortcutWayService shortcutWayService) {
		this.shortcutWayService = shortcutWayService;
	}
	public List<Menu> getMenu() {
		return menu;
	}
	public void setMenu(List<Menu> menu) {
		this.menu = menu;
	}
	public MenuService getMenuService() {
		return menuService;
	}
	public void setMenuService(MenuService menuService) {
		this.menuService = menuService;
	}
	
	@Action("editShortcutWay")
	public String editShortcutWay(){
		this.menu=this.getMenuService().getAllMenu();
		return SUCCESS;
	}
	
	@Action(value="saveShortcutWay",results={
			@Result(name="success",type="redirect",location="editShortcutWay?shortcutWay={shortcutWay.getId()}"),
			@Result(name="error",type="chain",location="editShortcutWay")
	})
	public String saveShortcutWay(){
		this.getShortcutWayService().save(shortcutWay);
		return SUCCESS;
	}
}
